package com.zcareu.logServ.repo;

import com.zcareu.logServ.entity.Filter;
import com.zcareu.logServ.entity.OwnedFilters;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OwnedFiltersRepo extends JpaRepository<OwnedFilters, Long> {

    @Query("SELECT f FROM Filter f WHERE f.name IN (select ofs.filterName from OwnedFilters ofs where ofs.username = ?1)")
    List<Filter> findAllFilterNamesByOwner(String username);
}
